package com.asiainfo.integration.json;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.log4j.Logger;

import java.util.ArrayList;
import java.util.List;

/**
 * Usage:
 *
 * @author Charkey
 * @date 4/13/2016
 */
public class JsonTest {

    private transient static String name1 = "Charkey";
    private transient final String name2 = "Charkey";
    private volatile static String name3 = "Charkey";
    //private volatile final String name4 = "Charkey";

    public static void main(String[] args) {
        String resJson = "{\"data\":\"\",\"hub_code\":\"1\",\"code\":\"\",\"value\":\"\",\"hub_value\":[]}";
        JSONObject jsonObj = JSONObject.fromObject(resJson);

        String dataList = jsonObj.get("data").toString();
        //JSONArray dataListJSONArray = JSONArray.fromObject(dataList);

        System.out.println();Logger logger = Logger.getLogger(JsonTest.class);
        logger.error("");

        print("name1", "name2");

        List<String> stringList = new ArrayList<String>();
        stringList.add("1111");
        stringList.add("2222");
        for (String str : stringList) {
            System.out.println(str);
        }
    }

    private static void print(String... names) {
        for (String name: names) {
            System.out.println(name);
        }
    }
}
